How to solve one equation for two variables